package br.ufc.vv.controller;

import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import br.ufc.vv.dao.DaoFactory;
import br.ufc.vv.model.Candidato;

public class CmdListarCandidatos implements Comando{

	@Override
	public String executar(HttpServletRequest request, HttpServletResponse response) {
		List<Candidato> candidatos = DaoFactory.findCandidatos();

		HttpSession session = request.getSession(true);

		if (candidatos != null) {
			session.setAttribute("candidatos", candidatos);
			return "paginaJSP";
		}
		return null;
	}
}
